<template>
	<view class="">
		<view class="u-flex flex_j_c" style="height: 50px;width: 100%;background-color: #FFFFFF;position: fixed;left: 0px;bottom: 0px;z-index: 999;">
			<view class="flex-c-c-c" style="width: 50%;height: 100%;" v-for="(v,i) in tablist" :key="i" @click="jump(i,v)">
				<image :src="active===i?v.selectedIconPath:v.iconPath" mode="heightFix" style="height:23px;"></image>
				<text style="font-size: 12px;margin-top: 2px;" :style="{color:active===i?'#0F4C3A':'#999999'}">{{v.text}}</text>
			</view>
		</view>
		<!-- 占位view -->
		<view style="height: 50px;width: 100%;"></view>
	</view>
</template>

<script>
	export default {
		name: "tabbar",
		props: {
			active: {
				type: Number,
				default: 0
			},
		},
		data() {
			return {
				list: [ {
					"pagePath": "/pages/store/index",
					"iconPath": "/static/tabBar/order.png",
					"selectedIconPath": "/static/tabBar/orderlv.png",
					"text": "我的订单"
				}, {
            "pagePath": "/pages/user/index",
            "iconPath": "/static/tabBar/mine1.png",
            "selectedIconPath": "/static/tabBar/mine2.png",
            "text": "个人中心"
          }],
        storeList:[{
            "pagePath": "/pages/store/index",
            "iconPath": "/static/tabBar/mendian.png",
            "selectedIconPath": "/static/tabBar/mendianlv.png",
            "text": "门店订单"
          },{
          "pagePath": "/pages/user/index",
          "iconPath": "/static/tabBar/mine1.png",
          "selectedIconPath": "/static/tabBar/mine2.png",
          "text": "个人中心"
        }]
			};
		},
    computed:{
		  tablist(){
        let type = uni.getStorageSync('type') //1是技师，2是门店
		    if(type ==2) return this.storeList
		    if(type ==1) return this.list
      },
    },

		methods:{
			jump(i,data){//自定义tabbar点击跳转
          uni.switchTab({
            url:data.pagePath
          })

			}
		},
	}
</script>

<style lang="less">

</style>
